package com.gao.controller;


import com.gao.pojo.Dept;
import com.gao.service.DeptService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/dept")
public class DeptController {

    @Autowired
    private DeptService deptService;


    @GetMapping("/get/{id}")
    public Dept getDept(@PathVariable("id") Integer id) {
        return deptService.getDept(id);
    }


    @GetMapping("/get/list")
    public List<Dept> getDeptAll() {
        return deptService.getDeptAll();
    }

    @PostMapping("/add")
    public void addDept(@RequestBody Dept dept) {
        deptService.addDept(dept);
    }
}
